﻿using System;
using System.Data;
using System.Linq;
using ReflectionStudio.Core.Events;
namespace WPFExcelReport
{
    public partial class ITXEXRPT
    {

        private void YGRQCBX(DataSet db)
        {
            try
            {
                exAgent.SetCurrentSheet("YGRQCBX");
                DataTable dtSoruce = db.Tables["ABFOLGE"];
                DataTable dtOutput = new DataTable();
                int idx = 1;
                exAgent.SetCellValue(3, idx++, "批号"); dtOutput.Columns.Add("GPPARTIE", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "质检单号"); dtOutput.Columns.Add("QOKORDER", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "品种"); dtOutput.Columns.Add("ABPART", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "色号"); dtOutput.Columns.Add("ABPFARBE", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "纱型"); dtOutput.Columns.Add("TYP", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "支数值"); dtOutput.Columns.Add("B001", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "条干CV%"); dtOutput.Columns.Add("B002", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "细节-50%	"); dtOutput.Columns.Add("B003", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "粗节+50%	"); dtOutput.Columns.Add("B004", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "棉结+140%"); dtOutput.Columns.Add("B005", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "棉结+200%"); dtOutput.Columns.Add("B006", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "棉结+280%"); dtOutput.Columns.Add("B007", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "毛羽H"); dtOutput.Columns.Add("B008", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "单强CN"); dtOutput.Columns.Add("B009", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "最小强力CN"); dtOutput.Columns.Add("B010", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "单强CV%"); dtOutput.Columns.Add("B011", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "强度CN/TEX"); dtOutput.Columns.Add("B012", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "断裂伸长E"); dtOutput.Columns.Add("B013", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "捻度T/10CM"); dtOutput.Columns.Add("B014", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "捻度CV%"); dtOutput.Columns.Add("B015", typeof(System.String));
                exAgent.SetCellValue(3, idx++, "备注"); dtOutput.Columns.Add("B050", typeof(System.String));
                dtOutput.Merge(dtSoruce, false, MissingSchemaAction.Ignore);
                foreach (DataRow row in dtOutput.Rows)
                {
                    row["GPPARTIE"] = GetGB2312Value(row["GPPARTIE"].ToString());
                    row["ABPFARBE"] = GetGB2312Value(row["ABPFARBE"].ToString());
                    row["B050"] = GetGB2312Value(row["B050"].ToString());
                }
                exAgent.DataTableToExcel(dtOutput, 4, 1);

                int count = dtOutput.Rows.Count;
                exAgent.SetCellValue(1, 1, 1);
                exAgent.BatchConvert2Number(4, 2, count + 3, 2);
                exAgent.BatchConvert2Number(4, 6, count + 3, 20);
                exAgent.SetCellValue(1, 1, "并线质量");

            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }

    }
}